<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page contentType="text/html;charset=UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">
		<link href="themes/css/ui.common.css" rel="stylesheet" type="text/css" />
		<link href="themes/css/ui.child.css" rel="stylesheet" type="text/css" />
		<link href="themes/css/ui.tips.css" rel="stylesheet" type="text/css" />
		<link href="style/jquery_ui/jquery-ui-1.8.custom.css" rel="stylesheet"
			type="text/css" />
		<link id="skin_css" rel="stylesheet" type="text/css"
			href="themes/css/ui.c.blue.css"></link>
		<link rel="stylesheet" href="themes/default/pagination.css"
			type="text/css"></link>
		<link rel="stylesheet" href="themes/css/ui.validation.css" type="text/css"></link>
		<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
		<script src="Scripts/jquery-ui-1.8.custom.min.js"
			type="text/javascript"></script>
		<script src="Scripts/ui.tips.js" type="text/javascript"></script>
		<script src="Scripts/ui.default.js " type="text/javascript"
			charset="UTF-8"></script>
		<script src="Scripts/ui.admincp.js" type="text/javascript"
			charset="UTF-8"></script>
		<script type="text/javascript" src="Scripts/jquery.json-2.2.min.js"></script>
		<STYLE type="text/css">
		.editorArea {
			display: none;
		}
		</STYLE>
		<script type="text/javascript" src="Scripts/ui.dialogFormHelper.js"></script>
		<script type="text/javascript" src="Scripts/ui.validation.js?rand=Sq2ds32q"></script>
		<script type="text/javascript">
		$(function () {
			setValidate();
		});
		
		function setValidate(){  
	   		$("#form").validatingForm({
	      	  submitButtonId:"#btnSubmit",
	     	  clearErrorsOnFocus:true,
	      	  validateOnBlur:true,
	      	  summaryTo:"#errorSummary"
	       });
	    }
		
		function batchAdd(){
			$("#btn_batchAdd").attr("disabled", true);
			var filename = $("#batchAddStudentInfo").val();
			if(filename == ""){
				alert("请选择需要批处理新增学生信息的文件");
				$("#btn_batchAdd").attr("disabled", false);
				return false;
			}
			if(filename.substring(filename.length-3) != 'xls'){
				alert("请选择xls格式的文件");
				$("#btn_batchAdd").attr("disabled", false);
				return false;
			}
			$.post("studentInfo!batchAddStudent.action", {"filename":filename},
			function (data) {
				if("-2" == data){
					alert("操作异常！");
				}if("-1" == data){
					alert("该表为空表！");
				}else if("0" == data){
					alert("模板错误！");
				}else if("1" == data){
					alert("操作成功！");
				}else{
					alert(data);
				}
				$("#btn_batchAdd").attr("disabled", false);
			});
		}
		</script>
	</head>
	<body>
		<div class="PageChild_Title">
			<img src=" themes/images/default/icons/archives.png"
				class="PageChild_Tbtnpic" />
			<span class="PageChild_separate"></span>
			<span class="PageChild_TbtnText">
				<h2>新增学生信息	</h2>
			</span>
			<span class="PageChild_separate"></span>
			<div id="marker" class="red-tips">
			</div>
			<div class="clear">
			</div>
		</div>
		<s:form action="studentInfo!addStudent.action" method="post" enctype ="multipart/form-data">
		<table  id="form" style="border: 1px solid gray; padding: 1px;" border="0"
			cellpadding="0" cellspacing="0" align="center">
			<tr>
				<td colspan="8" align="center">
					
				</td>
			</tr>
			<tr>
				<td colspan="8" align="center">
					<b>基本信息</b>
				</td>
			</tr>
			<tr>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;学号:
				</td>
				<td style="width: 110px" valign="middle" class="style1">
					<s:textfield id="txt_stuNo" name="stuNo" fieldName="学号" cssClass="control-width-100 required-field no-Chinese-field input-control clearable" theme="simple"/>
				</td>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;姓名:
				</td>
				<td style="width: 110px" valign="middle" class="style1">
					<s:textfield id="txt_stuName" name="stuName" fieldName="姓名" cssClass="control-width-100 required-field input-control clearable" theme="simple"/>
				</td>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;密码:
				</td>
				<td style="width: 110px" valign="middle" class="style1">
					<input name="stuPwd" class="control-width-100 input-control clearable" value="随机生成六位密码" disabled="disabled">
				</td>
				<td style="width: 300px" valign="middle" align="center" class="style1" rowspan="5" colspan="2">
					<img alt="一寸照片" src="getPhoto.action"><br />
					&nbsp;照片：<s:file name ="stuPhoto" cssClass="control-width-100 input-control" theme="simple"/>
				</td>
			</tr>
			<tr>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;性别:
				</td>
				<td style="width: 110px" valign="middle" class="style1">
					<s:select list="#{'男':'男','女':'女'}" headerKey="-1" headerValue="-请选择-" id="dl_gender" name="gender" theme="simple" emptyValueMsg="请选择性别。" emptyValueForValidate="-1" cssClass="control-width-40 selectable-field clearable" cssStyle="width: 152px; height: 26px"></s:select>
				</td>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;身份证号:
				</td>
				<td style="width: 110px" valign="middle" class="style1">
					<s:textfield id="txt_idCard" name="idCard" fieldName="身份证号" cssClass="control-width-100 required-field IDCard-field input-control clearable" theme="simple"/>
				</td>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;邮箱:
				</td>
				<td style="width: 110px" valign="middle" class="style1">
					<s:textfield id="txt_mail" name="mail" fieldName="邮箱" cssClass="control-width-100 required-field email-field input-control clearable" theme="simple"/>
				</td>
			</tr>
			<tr>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;家乡:
				</td>
				<td style="width: 110px" valign="middle" class="style1">
					<s:textfield id="txt_hometown" name="hometown" fieldName="家乡" cssClass="control-width-100 required-field input-control clearable" theme="simple"/>
				</td>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;政治面貌:
				</td>
				<td style="width: 110px" valign="middle" class="style1">
					<s:select list="#{'团员':'团员','预备党员':'预备党员','党员':'党员','群众':'群众'}" headerKey="-1" headerValue="-请选择-" id="dl_politician" name="politician" theme="simple" emptyValueMsg="请选择政治面貌。" emptyValueForValidate="-1" cssClass="control-width-40 selectable-field clearable" cssStyle="width: 152px; height: 26px"></s:select>
				</td>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;手机号码:
				</td>
				<td style="width: 110px" valign="middle" class="style1">
					<s:textfield id="txt_telphone" name="telphone" fieldName="手机号码" cssClass="control-width-100 required-field telphone-field input-control clearable" theme="simple"/>
				</td>
			</tr>
			<tr>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;专业:
				</td>
				<td style="width: 110px" valign="middle" class="style1">
					<s:select list="majorInfoList" listKey="majorId" listValue="majorName" headerKey="-1" headerValue="-请选择-" id="dl_majorId" name="majorId" theme="simple" emptyValueMsg="请选择专业。" emptyValueForValidate="-1" cssClass="selectable-field control-width-40 clearable" cssStyle="width: 152px; height: 26px"></s:select>
				</td>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;年级:
				</td>
				<td style="width: 110px" valign="middle" class="style1">
					<s:textfield id="txt_grade" name="grade" fieldName="年级" cssClass="control-width-100 required-field input-control clearable" theme="simple"/>
				</td>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;银行卡号:
				</td>
				<td style="width: 110px" valign="middle" class="style1">
					<s:textfield id="txt_cardId" name="cardId" fieldName="银行卡号" cssClass="control-width-100 required-field number-field input-control clearable" theme="simple"/>
				</td>
			</tr>
			<tr>
				<td colspan="8" align="center">
					&nbsp;
				</td>
			</tr>
			<tr>
				<td colspan="8" align="center">
					<br /><b>家庭信息</b>
				</td>
			</tr>
			<tr>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;父亲姓名:
				</td>
				<td style="width: 110px" valign="middle" class="style1">
					<s:textfield id="txt_fatherName" fieldName="父亲姓名" name="fatherName" cssClass="control-width-100 required-field input-control clearable" theme="simple"/>
				</td>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;联系电话:
				</td>
				<td style="width: 110px" valign="middle" class="style1">
					<s:textfield id="txt_fatherTel" name="fatherTel" fieldName="父亲联系电话" cssClass="control-width-100 telphone-field input-control clearable" theme="simple"/>
				</td>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;母亲姓名:
				</td>
				<td style="width: 110px" valign="middle" class="style1">
					<s:textfield id="txt_motherName" name="motherName" fieldName="母亲姓名" cssClass="control-width-100 required-field input-control clearable" theme="simple"/>
				</td>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;联系电话:
				</td>
				<td style="width: 110px" valign="middle" class="style1">
					<s:textfield id="txt_motherTel" name="motherTel" fieldName="母亲联系电话"  cssClass="control-width-100 telphone-field input-control clearable" theme="simple"/>
				</td>
			</tr>
			<tr>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;家庭地址:
				</td>
				<td style="width: 110px" valign="middle" class="style1" colspan="7">
					<s:textfield id="txt_address" name="address" fieldName="家庭地址" cssClass="control-width-100 required-field input-control clearable" theme="simple"/>
				</td>
			</tr>
			<tr>
				<td colspan="8" align="center">
					<br /><b>入学成绩</b>
				</td>
			</tr>
			<tr>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;考号:
				</td>
				<td style="width: 110px" valign="middle" class="style1" colspan="7">
					<s:textfield id="txt_examNo" name="examNo" fieldName="考号" cssClass="control-width-100 required-field input-control clearable" theme="simple"/>
				</td>
			</tr>
			<tr>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;语文:
				</td>
				<td style="width: 110px" valign="middle" class="style1">
					<s:textfield id="txt_chinese" name="chinese" fieldName="语文成绩" cssClass="control-width-100 required-field score-field input-control clearable" theme="simple"/>
				</td>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;数学:
				</td>
				<td style="width: 110px" valign="middle" class="style1">
					<s:textfield id="txt_math" name="math" fieldName="数学成绩" cssClass="control-width-100 required-field score-field input-control clearable" theme="simple"/>
				</td>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;外语:
				</td>
				<td style="width: 110px" valign="middle" class="style1">
					<s:textfield id="txt_english" name="english" fieldName="外语成绩" cssClass="control-width-100 required-field score-field input-control clearable" theme="simple"/>
				</td>
				<td class="text-align-right" style="width: 80px;">
					&nbsp;综合:
				</td>
				<td style="width: 110px" valign="middle" class="style1">
					<s:textfield id="txt_comprehensive" name="comprehensive" fieldName="综合成绩" cssClass="control-width-100 required-field score-field input-control clearable" theme="simple"/>
				</td>
			</tr>
			<tr>
				<td colspan="8" align="center">
					<input id="btnSubmit" type="submit" class="o-btn" value="提交"/>
					&nbsp;
					<input id="btnReset" type="reset" value="重置" class="o-btn"/>
				</td>
			</tr>
			<tr>
				<td colspan="8" align="center">
					<div id="errorSummary"></div>
				</td>
			</tr>
		</table>
		</s:form>
		<div align="center">
			批量新增学生信息：<s:file id ="batchAddStudentInfo" cssClass="control-width-100 input-control" theme="simple"/>
			<input type="button" id="btn_batchAdd" class="o-btn" value="执行" onclick="batchAdd();">
		</div>
		
	</body>
</html>